What is @changesets/pre?
@changesets/pre is a tool designed to help manage pre-releases in a monorepo setup. It allows you to create, manage, and publish pre-releases of your packages, making it easier to test and iterate on changes before making a stable release.
What are @changesets/pre's main functionalities?
Enter Pre Mode
This command puts your repository into 'pre' mode, where all subsequent changesets will be treated as pre-releases. The 'beta' argument specifies the pre-release tag.
npx changeset pre enter beta
Exit Pre Mode
This command exits 'pre' mode, returning your repository to normal release behavior. Any subsequent changesets will be treated as stable releases.
npx changeset pre exit
Create a Changeset
This command creates a new changeset, which is a record of changes that will be included in the next release. In 'pre' mode, these changes will be part of the pre-release.
npx changeset add
Publish Pre-Release
This command publishes the pre-release packages to the npm registry. It ensures that the pre-release versions are correctly tagged and available for testing.
npx changeset publish
Other packages similar to @changesets/pre
lerna
Lerna is a tool for managing JavaScript projects with multiple packages. It offers similar functionalities for managing pre-releases, but it is more focused on monorepo management as a whole, including bootstrapping, linking, and versioning.
semantic-release
semantic-release automates the versioning and package publishing process based on the commit messages. It supports pre-releases through configuration and plugins, offering a more automated approach compared to @changesets/pre.
standard-version
standard-version is a tool for versioning and changelog generation based on conventional commits. It supports pre-releases through command-line options, providing a simpler alternative to @changesets/pre.
@changesets/pre
Enter and exit pre mode in a Changesets repo.
Usage
import { enterPre, exitPre } from "@changesets/pre";
await enterPre(cwd, tag);
let preState = await readPreState(cwd);
await exitPre(cwd);
This package is used by internally by Changesets to enter and exit pre mode along with reading the pre state for the publish
and version
commands, you should only need it if you're using @changesets/assemble-release-plan
, implementing Changesets or want to enter or exit pre mode programmatically.
Types
import { PreState } from "@changesets/types";
export function enterPre(cwd: string, tag: string): Promise<void>;
export function exitPre(cwd: string): Promise<void>;
export function readPreState(cwd: string): Promise<PreState>;